import http from "@/api";
import { ResPage } from "@/api/interface";

import {
  CompanyUserEntity,
  CompanyUserConfigVo,
  CompanyAccountVo,
  CompanyConfigCoinVo,
  CompanyCoinDetailVo
} from "@/biz/interface/CompanyType";

import { ModuleUmsUrl, ModuleMainUrl } from "..";

const umsModuleUrl = ModuleUmsUrl;
const mainModuleUrl = ModuleMainUrl;

// * 获取企业用户
export const getCompanyUserVoListApi = (params: {}) => {
  return http.post<ResPage<CompanyUserConfigVo>>(umsModuleUrl + `/cpy/uservolist`, params);
};

// * 新增企业用户
export const saveCompanyUserApi = (company: CompanyUserEntity) => {
  return http.post(umsModuleUrl + `/cpy/usersave`, company);
};

// * 新增企业用户
export const saveCompanyUserByPhoneApi = (company: CompanyUserEntity) => {
  return http.post(umsModuleUrl + `/cpy/userphonesave`, company);
};

// * 企业用户审核通过
export const companyUserAuditPApi = (params: { id: string }) => {
  return http.post(umsModuleUrl + `/cpy/useridp`, params);
};

// * 企业用户审核不通过
export const companyUserAuditFApi = (params: { id: string; auditContent: string }) => {
  return http.post(umsModuleUrl + `/cpy/useridf`, params);
};

//创建一个企业子帐号
export const saveCompanyUserConfigApi = (userId: string) => {
  return http.post(mainModuleUrl + `/cpy/userconfigsave`, { userId });
};

//删除一个企业子帐号，需结算
export const deleteCompanyUserConfigApi = (userId: string) => {
  return http.post(mainModuleUrl + `/cpy/userconfigdelete`, { userId });
};



// * 获取企业用户
export const getCompanyUserConfigsApi = (params: {}) => {
  return http.post<CompanyUserConfigVo>(mainModuleUrl + `/cpy/usersconfig`, params);
};

// * 获取企业所有用户的树结构
export const getCompanyUsersTreeApi = () => {
  return http.post(mainModuleUrl + `/cpy/usersconfigtree`, {});
};

// * 获取企业用户统计信息
export const getCompanyUserTongjiApi = (params: {}) => {
  return http.post<CompanyUserConfigVo>(mainModuleUrl + `/cpy/userstongji`, params);
};

// * 企业充值活动列表
export const companyChargeActivityApi = (params: {}) => {
  return http.post(mainModuleUrl + `/sysaty/coinvolist`, params);
};

// * 企业充值
export const companyChargeApi = (params: {}) => {
  return http.post(mainModuleUrl + `/cpy/charge`, params);
};

// * 企业充值支付二维码
export const companyChargeUrlApi = (params: { chargeId: string }) => {
  return http.post<string>(mainModuleUrl + `/cpy/chargeurl`, params);
};

// * 企业充值
export const companyPointChargeApi = (params: {}) => {
  return http.post(mainModuleUrl + `/cpy/buypoint`, params);
};

// * 企业帐号当前的 当家币号简历点啊啥的
export const getCompanyAccountInfoApi = (params: {}) => {
  return http.post<CompanyAccountVo>(mainModuleUrl + `/cpycoin/countcoininfo`, params);
};

// * 企业帐号当前的 当家币号简历点啊啥的
export const getCompanyAdminApi = (params: {}) => {
  return http.post<CompanyAccountVo>(mainModuleUrl + `/cpy/cpyadmin`, params);
};

// * 查看企业当家币流水帐
export const getCompanyCoinDetailVoApi = (params: {}) => {
  return http.post<ResPage<CompanyCoinDetailVo>>(mainModuleUrl + `/cpycoin/cpystreamdetails`, params);
};

export const getCompanyUserCoinDetailVoApi = (params: {}) => {
  return http.post<ResPage<CompanyCoinDetailVo>>(mainModuleUrl + `/cpycoin/cpyusrstreamdetails`, params);
};

// * 配置企业的当家币
export const getCompanyUserCoinConfigApi = (params: {}) => {
  return http.post<CompanyConfigCoinVo>(mainModuleUrl + `/cpy/coinconfig`, params);
};

// * 配置企业的当家币
export const saveCompanyUserCoinConfigApi = (params: {}) => {
  return http.post(mainModuleUrl + `/cpy/coinconfigsave`, params);
};

// * 上传用户认证信息
export const handleCompanyUserIdentityApi = (params: {}) => {
  return http.post(umsModuleUrl + `/sys/cpyuseridentity`, params);
};
